package com.example.myapplication.model.db.database;

import android.content.Context;

import androidx.room.Dao;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.myapplication.model.db.dao.ForumDao;
import com.example.myapplication.model.db.dao.ForumPicsDao;
import com.example.myapplication.model.db.dao.NewsCommentDao;
import com.example.myapplication.model.db.dao.UserDao;
import com.example.myapplication.model.entity.Forum;
import com.example.myapplication.model.entity.ForumPics;
import com.example.myapplication.model.entity.NewsComment;
import com.example.myapplication.model.entity.User;

@Database(entities = {User.class, NewsComment.class, ForumPics.class, Forum.class}, version = 1,exportSchema = false)
public  abstract class MyDatabase extends RoomDatabase {
    private static MyDatabase mydatabases;

    public static synchronized MyDatabase getDatabases(Context context){
        if(mydatabases == null){
            mydatabases = Room.databaseBuilder(context,MyDatabase.class,"WenDao")
                    .build();
        }
        return mydatabases;
    }

    public abstract UserDao userDao();
    public abstract ForumDao ForumDao();
    public abstract ForumPicsDao ForumPicsDao();
    public abstract NewsCommentDao NewsComment();

}
